import axiosIntercom from './axiosIntercom.js';

const apiIntercom = {};
//let HOST = "http://"+intercomHost;//可以用于忘记服务器设置卸载重装 112.33.14.243:8081

const errorHandler = error => {
    return Promise.reject(error);
};
const post = (url, params) => axiosIntercom.getInstance().post(url, params).catch(errorHandler);
apiIntercom.post = post;
/* 我的axios的封装请求的方法*/
apiIntercom.getALLUsers = (pageIndex,pageSize) => post('/pttDev/api/?method=getUsers&page=1',{pageIndex,pageSize});
apiIntercom.addUser = (name,passwd,nick) => post('/pttDev/api/?method=addUser',{name,passwd,nick});
apiIntercom.removeChannel = (cid) => post('/pttDev/api/?method=removeChannel',{cid});
apiIntercom.getChannels = (pageIndex,pageSize) => post('/pttDev/api/?method=getChannels&page=1',{pageIndex,pageSize});
apiIntercom.getMembers = (cid) => post('/pttDev/api/?method=getMembers',{cid});
apiIntercom.removeMember = (cid,memberids) => post('/pttDev/api/?method=removeMember',{cid,memberids});
apiIntercom.addMember = (cid,memberids) => post('/pttDev/api/?method=addMember',{cid,memberids});

export default apiIntercom;
